package com.chuanjiabao.wisdom.util.dialog;

import android.content.Context;
import android.databinding.DataBindingUtil;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import com.chuanjiabao.wisdom.R;
import com.chuanjiabao.wisdom.databinding.DialogThirdSelectBinding;
import com.chuanjiabao.wisdom.listener.OnBHClickListener;

public class ThirdSelectDialog extends BaseDialog implements View.OnClickListener {
    Context context;
    DialogThirdSelectBinding binding ;
    OnBHClickListener onBHClickListener;

    public ThirdSelectDialog(Context context) {
        super(context);
        this.context = context;
        binding = DataBindingUtil.inflate(
                LayoutInflater.from(context),
                R.layout.dialog_third_select,
                null,
                false
        );
        binding.setDialog(this);
        setContentView(binding.getRoot());
        WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
        layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
        layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        getWindow().setAttributes(layoutParams);
        //弹窗弹出在底部，默认中部
        getWindow().setGravity(Gravity.BOTTOM);
        binding.tvModuleFirst.setOnClickListener(this);
    }

    public void setOnBHClickListener(OnBHClickListener onBHClickListener) {
        this.onBHClickListener = onBHClickListener;
    }

    public void noPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onCloseClick();
        }
        dismiss();
    }

    public void okPoint(View view){
        if (onBHClickListener != null) {
            onBHClickListener.onConfirmClick();
        }
        dismiss();
    }

    public void setTitleText(String first,String second){
        binding.tvModuleSecond.setText(first);
        binding.tvModuleThird.setText(second);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.tvModuleFirst) {
            dismiss();
        }
    }

}


